var cache = require('../instances/cache.js');
var util = require('util');
var utilx = require('../lib/util');
var globalConfig = require("../configs/globalConfig");

module.exports = {
    /**
     * 登录LoginToken延时一小时
     * @param ctx
     * @param user
     */
    login: (ctx,user) => {
        var LoginToken = ctx.get("LoginToken");
        cache._client.jsetex(LoginToken,60 * 60,user);
    },
    /**
     * 获取当前用户
     * @param ctx
     */
    user: function *(ctx) {
        var LoginToken = ctx.get("LoginToken");
        return yield cache.jget(LoginToken);
    }
};
